package com.paris10.model;

import java.util.HashMap;
import java.util.Map;

public class FactorySource {
	
	private volatile static FactorySource instance;
	public static Map<Integer, AbstractSource> registre;
	
	private FactorySource(){
		registre=new HashMap<Integer, AbstractSource>();
	}
	
	public static FactorySource getInstance(){
		FactorySource test=instance;
		if(test==null){
			instance=test=new FactorySource();
		}
		return instance;
	}
	
	public static void enregistrerSource(int id, AbstractSource source){
		registre.put(id, source);
	}
	
	public AbstractSource createSource(int id, String titre, String chemin){
		return registre.get(id).createSource(titre, chemin);
		
	}

}
